package com.github.pig.admin.service.zhgl.propertyassess.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pig.admin.mapper.zhgl.propertyassess.PropertyAssessMapper;
import com.github.pig.admin.model.zhgl.propertyassess.AssessDetaiEntity;
import com.github.pig.admin.model.zhgl.propertyassess.PropertyAssess;
import com.github.pig.admin.service.sysFile.SysFileService;
import com.github.pig.admin.service.zhgl.propertyassess.IPropertyAssessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 物业人员评价表 服务实现类
 * </p>
 *
 * @author xiaosa
 * @since 2018-06-11
 */
@Service
public class PropertyAssessServiceImpl extends ServiceImpl<PropertyAssessMapper, PropertyAssess> implements IPropertyAssessService {


    @Autowired
    private PropertyAssessMapper propertyAssessMapper;
    @Autowired
    private SysFileService sysFileService;

//    @Override
//    public Page getPropertyUsers(Page page,SelectTotal selectTotalWhere) {
//        List<SysUser> result =  propertyAssessMapper.getPropertyUsers(page,selectTotalWhere);
//        StringBuffer imgPath = new StringBuffer();
//        //获取用户头像
//        for(SysUser sysUser:result){
//            //获取图片
//            EntityWrapper fileWrapper = new EntityWrapper();
//            fileWrapper.eq("relation_id",sysUser.getUserId());
//            fileWrapper.eq("del_flag", CommonConstant.STATUS_NORMAL);
//            //获取文件列表
//            List<SysFile> sysFiles = sysFileService.selectList(fileWrapper);
//            if(sysFiles!=null&&sysFiles.size()>0){
//                sysUser.setAvatar(sysFiles.get(0).getDocPath());
//            }else{
//                sysUser.setAvatar(null);
//            }
//
//        }
//        page.setRecords(result);
//        return page;
//    }

    @Override
    public Page detailPage(Page page,String propertyId) {
        List<AssessDetaiEntity> result =   propertyAssessMapper.getDetailData(page,propertyId);
        page.setRecords(result);
        return page;
    }
}